<?php
declare (strict_types=1);

namespace app\index\validate;

use think\Validate;

class Register extends Validate
{
    protected $rule = [
        "code" => "require|unique:user",
        "nickname" => "require",
        "mobile" => "require|mobile|unique:user",
//        "captcha" => "require",
        "parent_code" => "require",
        "password" => "require|min:6|confirm",
        "pay_password" => "require|min:6|confirm",
        "agree" => "require",
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
        'code.require' => '请填写会员编号',
        'code.unique' => '会员编号已被注册',
        'nickname.require' => '请填写姓名',
        'mobile.require' => '请填写手机号',
        'mobile.mobile' => '手机号格式错误',
        'mobile.unique' => '手机号已被注册',
//        'captcha.require' => '请填写验证码',
        'parent_code.require' => '请填写推荐人编号',

        'password.require' => '请填写登录密码',
        'password.min' => '登录密码过短',
        'password.confirm' => '确认登录密码不相符',

        'pay_password.require' => '请填写支付密码',
        'pay_password.min' => '支付密码过短',
        'pay_password.confirm' => '确认支付密码不相符',

        'agree.require' => '请您阅读并同意《注册协议》'
    ];
}
